<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script type="text/javascript" src="https://unpkg.com/devtools-detector@2.0.12/lib/devtools-detector.js"></script>
    <meta name="author" content="lijinbo" />
    <title>devtools-detector监听控制台打开</title>
    <style></style>
  </head>

  <body>
    <div class="box">
      <p>
        <a href="https://github.com/AEPKILL/devtools-detector" target="_blank"> 成熟的第三方库 devtools-detector </a>
      </p>
    </div>
    <script>
      const view = document.createElement('div')
      document.body.appendChild(view)

      devtoolsDetector.addListener(function (isOpen) {
        view.innerText = isOpen ? 'devtools status: open' : 'devtools status: close'
      })
      devtoolsDetector.launch()
    </script>
  </body>
</html>
